//
//  BaseViewController.m
//  Bubble
//
//  Created by A-01 on 2020/6/18.
//  Copyright © 2020 Mac. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    [self.navigationController setNavigationBarHidden:YES animated:YES];

}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = ZRWhiteColor;
    
    UIImageView * backView = [[UIImageView alloc] initWithFrame:self.view.bounds];
    
    backView.image = [UIImage imageNamed:@"backView"];
    
    self.backView = backView;
    
    [self.view addSubview:self.backView];
    
    
    UILabel * titleLabel = [UILabel new];
    
    titleLabel.textColor = [UIColor colorWithHexString:@"2C8FB4"];
    titleLabel.font = [UIFont boldSystemFontOfSize:25];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    
    self.titleLabel = titleLabel;
    
    [self.view addSubview:self.titleLabel];
    
    UIButton * backButton = [[UIButton alloc] init];
    
    [backButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(clickBackButton) forControlEvents:UIControlEventTouchUpInside];
    
    self.backButton = backButton;
    
    [self.view addSubview:self.backButton];
}

- (void)viewDidLayoutSubviews{
    
    [self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.view).offset(25);
        make.top.mas_equalTo(self.view).offset(Height_StatusBar + 15);
        make.height.width.mas_equalTo(30);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view);
        make.top.mas_equalTo(self.view).offset(Height_StatusBar + 15);
    }];
}

- (void)clickBackButton{

    [self.navigationController popViewControllerAnimated:YES];
}

@end
